package org.jeecg.modules.bj.util;

import org.apache.poi.hssf.usermodel.HSSFDateUtil;
import org.apache.poi.ss.usermodel.Cell;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.regex.Pattern;

public class FormBaseName {

	/**
	 * 表头名称2
	 * @param modelName
	 * @return
	 */
	public static Map<String,String> backExportRowMap2(final String modelName){
		Map<String,String> backMap = new TreeMap<String,String>(){
			{
				switch (modelName){
					case Constants.YGZYBAB:
					{
						put("0","序号");
						put("1","姓名");
						put("2","性别");
						put("3","年龄");
						put("4","岗位名称");
						put("5","子单位");
						put("6","用工来源");
						put("7","增员原因");
						put("8","增员时间");
						put("9","中介机构");
						put("10","身份证号");
						put("11","起薪时间");
						put("12","备注");
					}
					break;
					default:
						break;
				}
			}
		};
		return backMap;
	}
	
	/**
	 * 数据行2
	 * @param modelName
	 * @return
	 */
	public static Map<String,String> backExportDataRowMap(final String modelName){
		Map<String,String> backMap = new TreeMap<String,String>(){
			{
				switch (modelName){
					case Constants.YGZYBAB:
					{
						put("0","seq");
						put("1","name");
						put("2","sex");
						put("3","age");
						put("4","gwname");
						put("5","zdwname");
						put("6","ygly");
						put("7","zyreason");
						put("8","zydate");
						put("9","zjjg");
						put("10","sfzh");
						put("11","qxdate");
						put("12","remark");
					}
					break;
					default:
						break;
				}
			}
		};
		return backMap;
	}

	/**
	 * 单元格宽度
	 * @param modelName
	 * @return
	 */
	public static Map<String,String> backExportColumnWidthMap(final String modelName){
		Map<String,String> backMap = new TreeMap<String,String>(){
			{
				switch (modelName){
					case Constants.YGZYBAB:
					{
						put("0","15");
						put("1","15");
						put("2","15");
						put("3","15");
						put("4","15");
						put("5","15");
						put("6","15");
						put("7","15");
						put("8","15");
						put("9","15");
						put("10","15");
						put("11","15");
						put("12","15");
					}
					break;
					default:
						break;
				}
			}
		};
		return backMap;
	}
	/**
	 * 转换日期格式
	 *
	 * @return
	 */
	public static String strToDateFormat(String date) {
		try {
			SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
			formatter.setLenient(false);
			Date newDate = formatter.parse(date);
			formatter = new SimpleDateFormat("yyyy-MM-dd");
			return formatter.format(newDate);
		} catch (ParseException ex) {
			return date;
		}

	}
}
